import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from ttkbootstrap.dialogs import Messagebox
import tkinter as tk

# 初始化ttkbootstrap应用
app = ttk.Window(themename="flatly")
app.withdraw()  # 隐藏主窗口

# 测试yesno对话框的返回值
def test_messagebox_yesno():
    print("测试Messagebox.yesno的返回值:")
    result = Messagebox.yesno("这是一个测试对话框，点击'确定'或'取消'", "测试标题")
    print(f"返回值类型: {type(result)}")
    print(f"返回值内容: '{result}'")
    
    # 测试按钮文本
    yes_button_text = Messagebox._get_button_text('Yes')
    no_button_text = Messagebox._get_button_text('No')
    print(f"Yes按钮文本: '{yes_button_text}'")
    print(f"No按钮文本: '{no_button_text}'")
    
    # 测试直接比较
    is_yes = (result == "Yes")
    print(f"result == 'Yes': {is_yes}")
    
    is_yes_chinese = (result == "确定")
    print(f"result == '确定': {is_yes_chinese}")

# 运行测试
test_messagebox_yesno()

# 确保程序能够结束
app.after(1000, app.destroy)
app.mainloop()